﻿@inherits AdminCompontentBase
<MRow Class="mt-6">
    <MCol>
        <MCheckbox Class="mt-0" @bind-Value="Value.IsCustom" Disabled="ReadOnly" Label="@T("DisplayName.SendingRule.IsCustom")" TValue="bool"></MCheckbox>
    </MCol>
</MRow>
@if (Value.IsCustom)
{
    <MRow Class="mt-6">
        <MCol Md="12">
            <STextField @bind-Value="Value.CronExpression"
                    Label="@T("DisplayName.SendingRule.CronExpression")"
                    Disabled="ReadOnly"
                    TValue="string"
                    AppendIcon="mdi-clock" OnAppendClick="OpenCronModal" OnBlur="()=>GetNextRunTime()">
            </STextField>
        </MCol>
    </MRow>
    <MRow Class="mt-6">
        <MCol Md="6">
            <STextField @bind-Value="Value.SendingCount"
                    Label="@T("DisplayName.SendingRule.SendingCount")"
                    Disabled="ReadOnly"
                    Type="number">
                <AppendOuterContent>
                    <span class="regular2--text body2 my-auto flex-shrink-0">@T("DisplayName.SendingRule.SendingCount.Tips")</span>
                </AppendOuterContent>
            </STextField>
        </MCol>
    </MRow>
    @if (!string.IsNullOrEmpty(Value.CronExpression))
    {
        <MRow Class="mt-6">
            <MCol>
                <STextarea @bind-Value="_nextRunTimeStr" Readonly Outlined Rows="11" Label="@T("$masaBlazor.cron.demo.nextTenRunTime")">
                </STextarea>
                </MCol>
                </MRow>
    }
}

<SSimpleModal @bind-Value="@_cronVisible" Title="@T("DisplayName.SendingRule.CronExpression")" OnSave="SetCronExpression">
    <PCron @bind-Value="@(_tempCron)">
    </PCron>
</SSimpleModal>